<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        .header{
            position: absolute;
        }
    </style>
</head>

<body>
    <div id="root"></div>
</body>

</html>
<script src="https://unpkg.com/vue@next"></script>
<script>
    // 自定义指令 derective
    const app = Vue.createApp({
        data(){
            return{
                distance:110
            }
        },
        template: `
        <div>
            <div v-pos:right="distance" class="header">
                <input />
            </div>
        </div>
        `
    })
    app.directive('pos',(el,binding)=>{
            el.style[binding.arg]=(binding.value + "px")
    })
    const vm = app.mount('#root')
</script>